﻿using System;
using System.Reflection;
using mediaPrime.Common;

namespace mediaPrime.Core
{
    public static class Pathes
    {
        /// <summary>
        /// Path to mediaPrime.exe in installation folder
        /// </summary>
        public static string ApplicationPath
        {
            get
            {
                return Assembly.GetEntryAssembly().Location;
            }
        }

        /// <summary>
        /// Path to directory of mediaPrimes' installation folder
        /// </summary>
        public static string ApplicationDir
        {
            get
            {
                return System.IO.Path.GetDirectoryName(ApplicationPath);
            }
        }

        public static string ApplicationDataDir
        {
            get
            {
                return System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), Consts.APPNAME);
            }
        }


        public static string LogDir
        {
            get
            {
                return System.IO.Path.Combine(ApplicationDataDir, Consts.LOGDIR);
            }
        }

        public static string LogFile
        {
            get
            {
                return System.IO.Path.Combine(LogDir, Consts.CORELOGFILE);
            }
        }

        public static string ExtensionsDir
        {
            get
            {
#if DEBUG
                return System.IO.Path.GetFullPath(System.IO.Path.Combine(ApplicationDir, @"..\..\..\..\Extensions\Output\"));
#else
                return System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), Consts.APPNAME, Consts.EXTENSIONSDIR);
#endif
            }
        }

        public static string DefaultSettings
        {
            get
            {
                return System.IO.Path.Combine(ApplicationDir, Consts.DEFAULTSETTINGS);
            }
        }

        public static string UserSettings
        {
            get
            {
                return System.IO.Path.Combine(ApplicationDataDir, Consts.USERSETTINGS);
            }
        }

    }
}
